package com.time.hellotime.app;

import android.os.Bundle;

import com.tencent.connect.share.QQShare;
import com.time.hellotime.servermodel.dynamics.MyShareBean;

/**
 * qq 相关功能处理工具
 * Created by Bing on 2017/11/1.
 * E-mail is tx16bing@163.com
 */

public class QQManager {

    private MyShareBean share;

    private OnQQListener listener;

    public void setListener(OnQQListener listener) {
        this.listener = listener;
    }

    public QQManager(MyShareBean shareBean) {
        this.share = shareBean;
    }

    public void shareOnQQ() {
        final Bundle params = new Bundle();
        params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, share.getTargetUrl());
        params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, share.getImageUrl());
        params.putString(QQShare.SHARE_TO_QQ_TITLE, share.getTitle());
        params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "您好时间");
        params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE);
        params.putInt(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN); //打开这句话，可以实现分享纯图到QQ空间

        if (null != listener) {
            listener.onShare(params);
        }
    }

    public interface OnQQListener {

        void onShare(Bundle params);

    }

}
